This invention relates to computer applications and methods for sharing network packets delivered to a specified port among multiple applications.
Networked computers communicate with each other by exchanging data packets. Each computer has a set of predefined network ports, which act as mailboxes for incoming and outgoing messages. The ports are typically configured to support a particular network protocol, and hence to receive or send a type of packet that is compatible with the protocol. For example, one common port is the UDP (User Datagram Protocol) port, which provides a channel into the computer for Datagram packets that are communicated using TCP/IP (Transport Control Protocol/Internet Protocol). Datagram packets are sent to a specific UDP port by using a programming interface, such as xe2x80x9csocketsxe2x80x9d (a programming interface originated in Unix operating systems that allows network communication using a file I/O metaphor).
As network traffic continues its rapid growth and more developers introduce network-sensitive products and solutions, there is an increasing number of applications that want to use the predefined network ports. It is increasingly likely that more than one application will be interested in listening for packets delivered over a single port. For example, multiple applications might be interested in listening for SNMP (Simple Network Management Protocol) packets that are sent to a single trap destination port, or BOOTP (Bootstrap Protocol) packets that are broadcast over the network but received at a single port, or SLP (Service Location Protocol) multicast packets that are sent to a specific port.
Unfortunately, these ports are a limited resource within the computer. Many of the ports, such as the UDP ports, have the characteristic that if multiple applications wish to listen for incoming packets over the same port, only one of the applications will be able to receive the packets. While it is possible to xe2x80x9creusexe2x80x9d a port that is already being used by a different process, only a single copy of the incoming packet is delivered.
Accordingly, there is a need for a technique that enables multiple applications to share heavily used ports.
This invention concerns a system and method for sharing network ports among multiple applications. A port sharing protocol is implemented into the applications to facilitate delivery of data packets received over a single network port to all of the applications that contest ownership of that single port.
According to the protocol, each application attempts to bind to the contested port. The first application to successfully bind to the contested port is considered the xe2x80x9cprimaryxe2x80x9d application, and all remaining applications are deemed xe2x80x9csecondaryxe2x80x9d applications. The primary application listens for incoming packets delivered over the contested port.
Meanwhile, all secondary applications register themselves with the primary application through a separate registration port. They submit their registration requests, which include their IP addresses and a port number of the contested port, over the registration port. The primary application receives the requests and adds the secondary applications to a distribution list. When a data packet is received over the contested port, the primary application sends a copy of the packet to each secondary application on the distribution list via the registration port. The primary and secondary applications are then free to consume the packets for their own purposes. As a result, multiple applications are able to receive the same data packets received over one port.
An aspect of the port sharing protocol is that the primary application and secondary applications can be on the same or different computers. As an example, a primary application executing on one computer can forward messages received over the contested port to secondary applications running on remote computers connected via a sub-network.
Another aspect is that the secondary applications may run on computers that do not support the same network protocol used to initially deliver the packets to the contested port. For example, UDP packets might be delivered to the contested port using TCP/IP. The primary application, which supports both TCP/IP and IPX, may then distribute the packets to secondary applications using IPX.
The port sharing protocol also supports a configuration in which one secondary application is established to monitor multiple ports. In this arrangement, multiple primary applications bind to corresponding contested ports. The monitoring application then registers itself with all primary applications so that it collects the packets received over all of the contested ports.